<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="mainLayout.xhtml">
	
	<ui:define name="pageContent">
		<h:form id="searchForm">
			<p:commandButton value="#{resourceBundle['btn.new']}" action="new" />
			<p:panel header="#{resourceBundle['panel.search']}"  toggleable="true" collapsed="true">
				<p:panelGrid columns="3" >
					<ui:insert name="searchFields"/><!-- INSERT SEARCH FIELDS -->
				</p:panelGrid>
				<p:commandButton value="#{resourceBundle['btn.search']}" action="search" update="listTable" />
			</p:panel>
			
			<ui:insert name="listValues"/>
			
			<p:dataTable id="listTable" var="row" value="#{listModel}"
				paginator="true" 
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15"
				emptyMessage="#{resourceBundle['list.noData']}"
				paginatorAlwaysVisible="true">
				
				
				<ui:insert name="searchColumns"/>
				
				<p:column styleClass="actionColumn" exportable="false">
					<ui:insert name="actionColumns"/>
					<p:commandLink action="edit" title="#{resourceBundle['list.header.edit']}"
					styleClass="ui-icon ui-icon-pencil actionColumnElement">
						
						<f:setPropertyActionListener target="#{targetObject}"
							value="#{row}" />
					</p:commandLink>
					<p:commandLink execute="@this" render="@none"
						oncomplete="confirmation.show()"
						title="#{resourceBundle['list.header.delete']}"
						styleClass="ui-icon ui-icon-close actionColumnElement">
						<f:setPropertyActionListener target="#{targetObject}"
							value="#{row}" />
					</p:commandLink>
				</p:column>
			</p:dataTable>
			
			<p:dialog id="confirmDialog"
				message="#{resourceBundle['popup.confirm']}"
				header="#{resourceBundle['popup.confirm']}" severity="alert"
				widgetVar="confirmation">

				<p:commandButton id="confirm" value="#{resourceBundle['btn.delete']}"
					oncomplete="confirmation.hide()" action="delete"
					update="listTable" />
				<p:commandButton id="decline" value="#{resourceBundle['btn.cancel']}"
					onclick="confirmation.hide()" type="button" />
			</p:dialog>
		</h:form>
		
		<ui:insert name="afterForm"/>
	</ui:define>
</ui:composition>